<template>
  <div class="app">
    <nav class="navbar">
      <div class="nav-content">
        <div class="logo">AI Agent</div>
        <div class="nav-links">
          <RouterLink 
            to="/travel-master"
            :class="{ active: currentRoute === '/travel-master' }"
          >
            旅游大师
          </RouterLink>
          <RouterLink 
            to="/super-agent"
            :class="{ active: currentRoute === '/super-agent' }"
          >
            超级智能体
          </RouterLink>
        </div>
      </div>
    </nav>
    
    <main class="main-content">
      <RouterView v-slot="{ Component }">
        <Transition name="fade" mode="out-in">
          <component :is="Component" />
        </Transition>
      </RouterView>
    </main>
  </div>
</template>

<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'

const route = useRoute()
const currentRoute = computed(() => route.path)
</script>

<style>
/* 重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 根变量 */
:root {
  --primary-color: #007AFF;
  --secondary-color: #5856D6;
  --background-color: #f9f9f9;
  --text-color: #333333;
  --border-color: #e0e0e0;
  --navbar-height: 60px;
}

/* 全局样式 */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
}

/* 应用容器 */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 导航栏 */
.navbar {
  height: var(--navbar-height);
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.nav-links a:hover {
  color: var(--primary-color);
  background-color: rgba(0, 122, 255, 0.1);
}

.nav-links a.active {
  color: var(--primary-color);
  background-color: rgba(0, 122, 255, 0.1);
}

/* 主内容区域 */
.main-content {
  margin-top: var(--navbar-height);
  flex: 1;
  position: relative;
}

/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .nav-content {
    padding: 0 0.5rem;
  }
  
  .logo {
    font-size: 1.2rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .nav-links a {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
}
</style>